package com.usoft.grpc.example.search;

import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;

@javax.annotation.Generated("by gRPC proto compiler")
public class SearchServiceGrpc {

  private SearchServiceGrpc() {}

  public static final String SERVICE_NAME = "search.SearchService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi
  public static final io.grpc.MethodDescriptor<com.usoft.grpc.example.search.SearchRequest,
      com.usoft.grpc.example.search.SearchResponse> METHOD_SEARCH_WITH_SIMPLE_RPC =
      io.grpc.MethodDescriptor.create(
          io.grpc.MethodDescriptor.MethodType.UNARY,
          generateFullMethodName(
              "search.SearchService", "SearchWithSimpleRpc"),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchRequest.getDefaultInstance()),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchResponse.getDefaultInstance()));
  @io.grpc.ExperimentalApi
  public static final io.grpc.MethodDescriptor<com.usoft.grpc.example.search.SearchRequest,
      com.usoft.grpc.example.search.SearchResponse> METHOD_SEARCH_WITH_SERVER_SIDE_STREAM_RPC =
      io.grpc.MethodDescriptor.create(
          io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
          generateFullMethodName(
              "search.SearchService", "SearchWithServerSideStreamRpc"),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchRequest.getDefaultInstance()),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchResponse.getDefaultInstance()));
  @io.grpc.ExperimentalApi
  public static final io.grpc.MethodDescriptor<com.usoft.grpc.example.search.SearchRequest,
      com.usoft.grpc.example.search.SearchResponse> METHOD_SEARCH_WITH_CLIENT_SIDE_STREAM_RPC =
      io.grpc.MethodDescriptor.create(
          io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
          generateFullMethodName(
              "search.SearchService", "SearchWithClientSideStreamRpc"),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchRequest.getDefaultInstance()),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchResponse.getDefaultInstance()));
  @io.grpc.ExperimentalApi
  public static final io.grpc.MethodDescriptor<com.usoft.grpc.example.search.SearchRequest,
      com.usoft.grpc.example.search.SearchResponse> METHOD_SEARCH_WITH_BIDIRECTIONAL_STREAM_RPC =
      io.grpc.MethodDescriptor.create(
          io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
          generateFullMethodName(
              "search.SearchService", "SearchWithBidirectionalStreamRpc"),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchRequest.getDefaultInstance()),
          io.grpc.protobuf.ProtoUtils.marshaller(com.usoft.grpc.example.search.SearchResponse.getDefaultInstance()));

  public static SearchServiceStub newStub(io.grpc.Channel channel) {
    return new SearchServiceStub(channel);
  }

  public static SearchServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new SearchServiceBlockingStub(channel);
  }

  public static SearchServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new SearchServiceFutureStub(channel);
  }

  public static interface SearchService {

    public void searchWithSimpleRpc(com.usoft.grpc.example.search.SearchRequest request,
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver);

    public void searchWithServerSideStreamRpc(com.usoft.grpc.example.search.SearchRequest request,
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver);

    public io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchRequest> searchWithClientSideStreamRpc(
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver);

    public io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchRequest> searchWithBidirectionalStreamRpc(
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver);
  }

  public static interface SearchServiceBlockingClient {

    public com.usoft.grpc.example.search.SearchResponse searchWithSimpleRpc(com.usoft.grpc.example.search.SearchRequest request);

    public java.util.Iterator<com.usoft.grpc.example.search.SearchResponse> searchWithServerSideStreamRpc(
        com.usoft.grpc.example.search.SearchRequest request);
  }

  public static interface SearchServiceFutureClient {

    public com.google.common.util.concurrent.ListenableFuture<com.usoft.grpc.example.search.SearchResponse> searchWithSimpleRpc(
        com.usoft.grpc.example.search.SearchRequest request);
  }

  public static class SearchServiceStub extends io.grpc.stub.AbstractStub<SearchServiceStub>
      implements SearchService {
    private SearchServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private SearchServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected SearchServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new SearchServiceStub(channel, callOptions);
    }

    @java.lang.Override
    public void searchWithSimpleRpc(com.usoft.grpc.example.search.SearchRequest request,
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_SEARCH_WITH_SIMPLE_RPC, getCallOptions()), request, responseObserver);
    }

    @java.lang.Override
    public void searchWithServerSideStreamRpc(com.usoft.grpc.example.search.SearchRequest request,
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
      asyncServerStreamingCall(
          getChannel().newCall(METHOD_SEARCH_WITH_SERVER_SIDE_STREAM_RPC, getCallOptions()), request, responseObserver);
    }

    @java.lang.Override
    public io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchRequest> searchWithClientSideStreamRpc(
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
      return asyncClientStreamingCall(
          getChannel().newCall(METHOD_SEARCH_WITH_CLIENT_SIDE_STREAM_RPC, getCallOptions()), responseObserver);
    }

    @java.lang.Override
    public io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchRequest> searchWithBidirectionalStreamRpc(
        io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
      return asyncBidiStreamingCall(
          getChannel().newCall(METHOD_SEARCH_WITH_BIDIRECTIONAL_STREAM_RPC, getCallOptions()), responseObserver);
    }
  }

  public static class SearchServiceBlockingStub extends io.grpc.stub.AbstractStub<SearchServiceBlockingStub>
      implements SearchServiceBlockingClient {
    private SearchServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private SearchServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected SearchServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new SearchServiceBlockingStub(channel, callOptions);
    }

    @java.lang.Override
    public com.usoft.grpc.example.search.SearchResponse searchWithSimpleRpc(com.usoft.grpc.example.search.SearchRequest request) {
      return blockingUnaryCall(
          getChannel().newCall(METHOD_SEARCH_WITH_SIMPLE_RPC, getCallOptions()), request);
    }

    @java.lang.Override
    public java.util.Iterator<com.usoft.grpc.example.search.SearchResponse> searchWithServerSideStreamRpc(
        com.usoft.grpc.example.search.SearchRequest request) {
      return blockingServerStreamingCall(
          getChannel().newCall(METHOD_SEARCH_WITH_SERVER_SIDE_STREAM_RPC, getCallOptions()), request);
    }
  }

  public static class SearchServiceFutureStub extends io.grpc.stub.AbstractStub<SearchServiceFutureStub>
      implements SearchServiceFutureClient {
    private SearchServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private SearchServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected SearchServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new SearchServiceFutureStub(channel, callOptions);
    }

    @java.lang.Override
    public com.google.common.util.concurrent.ListenableFuture<com.usoft.grpc.example.search.SearchResponse> searchWithSimpleRpc(
        com.usoft.grpc.example.search.SearchRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_SEARCH_WITH_SIMPLE_RPC, getCallOptions()), request);
    }
  }

  public static io.grpc.ServerServiceDefinition bindService(
      final SearchService serviceImpl) {
    return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
      .addMethod(
        METHOD_SEARCH_WITH_SIMPLE_RPC,
        asyncUnaryCall(
          new io.grpc.stub.ServerCalls.UnaryMethod<
              com.usoft.grpc.example.search.SearchRequest,
              com.usoft.grpc.example.search.SearchResponse>() {
            @java.lang.Override
            public void invoke(
                com.usoft.grpc.example.search.SearchRequest request,
                io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
              serviceImpl.searchWithSimpleRpc(request, responseObserver);
            }
          }))
      .addMethod(
        METHOD_SEARCH_WITH_SERVER_SIDE_STREAM_RPC,
        asyncServerStreamingCall(
          new io.grpc.stub.ServerCalls.ServerStreamingMethod<
              com.usoft.grpc.example.search.SearchRequest,
              com.usoft.grpc.example.search.SearchResponse>() {
            @java.lang.Override
            public void invoke(
                com.usoft.grpc.example.search.SearchRequest request,
                io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
              serviceImpl.searchWithServerSideStreamRpc(request, responseObserver);
            }
          }))
      .addMethod(
        METHOD_SEARCH_WITH_CLIENT_SIDE_STREAM_RPC,
        asyncClientStreamingCall(
          new io.grpc.stub.ServerCalls.ClientStreamingMethod<
              com.usoft.grpc.example.search.SearchRequest,
              com.usoft.grpc.example.search.SearchResponse>() {
            @java.lang.Override
            public io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchRequest> invoke(
                io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
              return serviceImpl.searchWithClientSideStreamRpc(responseObserver);
            }
          }))
      .addMethod(
        METHOD_SEARCH_WITH_BIDIRECTIONAL_STREAM_RPC,
        asyncBidiStreamingCall(
          new io.grpc.stub.ServerCalls.BidiStreamingMethod<
              com.usoft.grpc.example.search.SearchRequest,
              com.usoft.grpc.example.search.SearchResponse>() {
            @java.lang.Override
            public io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchRequest> invoke(
                io.grpc.stub.StreamObserver<com.usoft.grpc.example.search.SearchResponse> responseObserver) {
              return serviceImpl.searchWithBidirectionalStreamRpc(responseObserver);
            }
          })).build();
  }
}
